package leetcode.median;

import java.util.Arrays;
import java.util.PriorityQueue;

/**
 * ClassName: $179_LargestNumber
 * Description:
 * date: 2021/9/13 9:40
 *
 * @author liyifan
 */
public class $179_LargestNumber {
    public String largestNumber(int[] nums) {
        PriorityQueue<String> heap = new PriorityQueue<>((x, y) -> (y + x).compareTo(x + y));

        for (Integer x:nums) {
            heap.offer(String.valueOf(x));
        }
        String res = "";
        while (heap.size() > 0) {
            res += heap.poll();
        }
        if (res.startsWith("0"))
            return "0";
        return res;
    }
}
